Skip to content

[Parked] TKM-157: Open a Tokamak thread from the CLI - #258

Closed
JustKira wants to merge 7 commits into
feat/tkm-167-clifrom
feat/tkm-157-open
Closed

JustKira wants to merge 7 commits into
feat/tkm-167-clifrom
feat/tkm-157-open

Conversation

@JustKira

@JustKira JustKira commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Linear: TKM-157. Stacked on #253; base: feat/tkm-167-cli.

tokamak open [folder] [--new]
  resolve the folder through the filesystem
  local: reuse the latest explicitly matching thread, or configure the default agent and create one
  shared: send no path and create a thread visible to every member
  ask the window to show the thread and report acknowledged, pending, or replaced

On the local server, ACP compares the real paths of explicit folders and validates the configured folder before a thread is written. An agent's implicit home folder is excluded. If there is no agent, the thread remembers a starter folder until the picker saves a folder in the agent settings. The CLI uses the base's authenticated discovery and checks server identity before opening the socket. Named server selection still needs a later storage change; use --server or TOKAMAK_SERVER with TOKAMAK_TOKEN.

The window defers open requests during Add a server. Requests expire after five minutes and are deleted on acknowledgement; a short-lived receipt lets the CLI distinguish acknowledgement from replacement. Two windows signed in as the same person may both switch. There is no claim mechanism.

The SDK has no server-only function modifier for an action's nested mutation. chat/open:record now accepts only an existing thread ID and queues the request for the authenticated user. It cannot take agent settings. The action prepares settings through the same provider configuration used by the picker, checks the resulting folder, and creates the thread through the existing insert mutation.

Success JSON: ok, threadId, created, folder, server, agent, folderRecorded, shown, and windowConnected. windowConnected reflects whether the CLI received an acknowledgement before its deadline.

Evidence

  • Before: The reviewer reproduced the wrong target for link/.. and a trailing-space folder, duplicates through the picker, navigation out of the connect form, and a local folder path being sent to a shared server.
  • After: The real-server CLI tests cover symlink traversal, rejection before insert, alias reuse, output streams, the request/receipt lifecycle, and removing the starter folder. A wire capture verifies the shared CLI request has no path; browser tests verify shared rows, connected selection, the connect form, and old requests.
Local command Result
proto run bun -- test packages/cli/tests Passed, 20 tests; the four focused open/acknowledgement tests also passed after the final changes.
proto run bun -- run --cwd plugins/chat test Passed, 20 tests.
cargo test -p server --no-fail-fast -- --test-threads=2 Passed; two real-agent cases ignored.
proto run bun -- run e2e:browser Passed on retry, 28 tests across Chromium and WebKit; the first run found the isolated ports occupied.
bash .ci/check.sh lint Passed after fixing one unused binding; warnings remain.
bash .ci/check.sh ts Passed.

Merge Danger

Door: Two-way. This PR adds request and receipt tables and an optional starter folder on threads.

Blast Radius: CLI and Chat.

@JustKira
JustKira marked this pull request as draft November 20, 2026 14:08
@JustKira JustKira changed the title TKM-157: Open a Tokamak thread from the CLI [Parked] TKM-157: Open a Tokamak thread from the CLI Nov 20, 2026
@JustKira

Copy link
Copy Markdown
Contributor Author

Parked. tokamak open is out of the first spec for now, so this pull request is not part of the stack and should not be merged with it. The reasons and the cheaper shapes that were discussed are on the Linear ticket TKM-157.

@JustKira

Copy link
Copy Markdown
Contributor Author

Closing without merging. The plugin shape, the server engine and sign-in are being decided again (Linear TKM-194 and TKM-195), and this work sits on top of them. Nothing is lost: the head commit is a8b60ab, and git fetch origin pull/258/head brings it back.

@JustKira JustKira closed this Nov 21, 2026
@JustKira
JustKira deleted the feat/tkm-157-open branch November 21, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant